package com.demo.app;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.client.RestTemplate;

@Controller
public class testContrl {
	
	@RequestMapping (value = "test",method=RequestMethod.GET)
	@ResponseBody
	public String test() {
		RestTemplate restTemplate = new RestTemplate();
		String result = restTemplate.getForObject("http://baidu.com", String.class);
		return result;
	}
	
	@RequestMapping (name = "test1")
	public String test1(Model model) {
		String xx = "ceshi";
		model.addAttribute("name",xx);
		return "app";
	}
	

}
